	FUNCTION splint(xa,ya,y2a,x)
	USE nrtype; USE nrutil0, ONLY : assert_eq,nrerror
	!USE nr, ONLY: locate
	USE INTERPOL, only : locate
	IMPLICIT NONE
	REAL(DP), DIMENSION(:), INTENT(IN) :: xa,ya,y2a
	REAL(DP), INTENT(IN) :: x
	REAL(DP) :: splint
	INTEGER(I4B) :: khi,klo,n
	REAL(DP) :: a,b,h
	n=assert_eq(size(xa),size(ya),size(y2a),'splint')
	klo=max(min(locate(xa,x),n-1),1)
	khi=klo+1
	h=xa(khi)-xa(klo)
	if (h == 0.0) call nrerror('bad xa input in splint')
	a=(xa(khi)-x)/h
	b=(x-xa(klo))/h
	splint=a*ya(klo)+b*ya(khi)+((a**3-a)*y2a(klo)+(b**3-b)*y2a(khi))*(h**2)/6.0_dp
	END FUNCTION splint
